#ifndef TURNBACK_H
#define TURNBACK_H

#include <QWidget>
#include <QTimer>


namespace Hydra_Turnback {

enum TURNBACK_STATUS
{
    INIT,
    AVAILABLE,
    ACTIVATE
};
}

using namespace Hydra_Turnback;

class Turnback : public QWidget
{
    Q_OBJECT

public:
    Turnback(QWidget *parent = 0);
    void setInterval(quint16 interval);
    void setStatus(TURNBACK_STATUS state);

public slots:
    void refresh();


protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);
    void drawTurnbackImage(QPainter *pPainter);
    void initParam();


private:
    QColor mAvailableColor = QColor(45, 144, 51);
    QColor mActivateColor = QColor(255, 242, 0);
    TURNBACK_STATUS mStatus = TURNBACK_STATUS::INIT;
    quint8 mImageWidthProportion = 50;
    quint8 mImageHeightWidthProportion = 50;
    quint8 mLineWidthHeightProportion = 25;
    quint8 mLineWidth;
    QPoint mFork;
    QPoint mEnd0;
    QPoint mEnd1;
    QPoint mEnd2;
    QPoint mTurn1;
    QPoint mTurn2;
    QTimer mTimer;
};

#endif // TURNBACK_H
